# -*- coding: utf-8 -*-
# @Time : 2022/1/14 10:46
# @Author : Limusen
# @File : demo_connect_01

import time
from appium import webdriver

des = {
    "platformName": "Android",
    "platformVersion": "9.0",
    "deviceName": "Samsung Galaxy S9",
    "browserName": "Chrome",
    "udid": "192.168.0.101:5555",
    "noReset": "True",
    "chromedriverExecutable": r"D:\apk\chromedriver.exe",
}

driver = webdriver.Remote('http://127.0.0.1:4723/wd/hub', des)
driver.implicitly_wait(5)
driver.get("https://www.baidu.com")
time.sleep(3)
# 语法跟ui自动化一样
driver.find_element_by_xpath("//*[@id='index-kw']").send_keys("newdream")
driver.find_element_by_id('index-bn').click()